#!MC 900
##This macro animates xy points along a curve such that the curve seems  
##to grow.  For example, if you chose to animate 10 points, then for the 
##first animation frame, points 1-10 are shown.  For animation frame #2
##points 1-20 are shown, and so forth.  

##Last modified by Chris Idso - Tecplot, Inc  12/30/2003
##Updated by Chris Idso on 4/6/2006

$!VARSET |ANIMFILE| = "swf"
$!VARSET |EXPFORM| = "FLASH"

$!PROMPTFORTEXTSTRING |ANIMFORMAT|
   INSTRUCTIONS = "Enter animation format (1 - FLASH, 2 - AVI, 3 - RM, 4 - jpegs):"

$!IF |ANIMFORMAT| == 2
  $!VARSET |ANIMFILE| = "avi"
  $!VARSET |EXPFORM| = "AVI"
$!ENDIF 

$!IF |ANIMFORMAT| == 3
  $!VARSET |ANIMFILE| = "rm"
  $!VARSET |EXPFORM| = "RASTERMETAFILE"
$!ENDIF 

$!IF |ANIMFORMAT| == 4
    $!VARSET |ANIMFILE| = "jpeg"
    $!VARSET |EXPFORM| = "JPEG"
$!ENDIF 

$!Export 
  ExportRegion = AllFrames
$!PROMPTFORTEXTSTRING |AFNAME|
   INSTRUCTIONS = "Choose a name for the animation file:"

$!PROMPTFORTEXTSTRING |NUMXYPOINTS|
   INSTRUCTIONS = "Enter the number of  XY points to animate"

$!PROMPTFORTEXTSTRING |MAPNUM|
   INSTRUCTIONS = "Enter the number of the XY map to animate"
   
$!EXPORTSETUP 
   EXPORTFNAME = "|AFNAME|.|ANIMFILE|" 
   EXPORTFORMAT = |EXPFORM|

$!IF |ANIMFORMAT| == 4
    $!ExportSetup ImageWidth = 2000
    $!ExportSetup UseSuperSampleAntiAliasing = Yes
    $!ExportSetup Quality = 100
$!ENDIF 

$!VARSET |STARTINDEX| = 1
$!VARSET |ENDINDEX| = |NUMXYPOINTS|
$!ACTIVEXYMAPS += [|MAPNUM|]   

$!WHILE |ENDINDEX| <= |MAXI|
    $!XYMAP [|MAPNUM|]  INDICES{IRANGE{MIN = 1}}
    $!XYMAP [|MAPNUM|]  INDICES{IRANGE{MAX = |ENDINDEX|}}

    $!REDRAW
    $!IF |STARTINDEX| == 1
        $!EXPORTSTART      
    $!ENDIF
    $!IF |STARTINDEX| <> 1
        $!IF |ANIMFORMAT| == 4
            $!EXPORTSETUP EXPORTFNAME = "|AFNAME|-|STARTINDEX|.|ANIMFILE|" 
        $!ENDIF
        $!EXPORTNEXTFRAME     
    $!ENDIF
    $!VARSET |STARTINDEX| += 1
    $!VARSET |ENDINDEX| += |NUMXYPOINTS|
    
$!ENDWHILE

$!IF |ENDINDEX|<> |MAXI|
   $!XYMAP [|MAPNUM|]  INDICES{IRANGE{MIN = 1}}
   $!XYMAP [|MAPNUM|]  INDICES{IRANGE{MAX = |MAXI|}}
   $!REDRAW
   $!IF |ANIMFORMAT| == 4
       $!EXPORTSETUP EXPORTFNAME = "|AFNAME|-|STARTINDEX|.|ANIMFILE|" 
   $!ENDIF
   $!EXPORTNEXTFRAME
$!ENDIF

$!EXPORTFINISH

$!REMOVEVAR |STARTINDEX|
$!REMOVEVAR |ENDINDEX|
$!REMOVEVAR |NUMXYPOINTS|
$!REMOVEVAR |ANIMFORMAT|
$!REMOVEVAR |ANIMFILE|
$!REMOVEVAR |EXPFORM|
$!REMOVEVAR |MAPNUM|
